package org.kessy.common.model.meta;

/***
 * 
 * @author leo.liu
 * Meta Relation, represent the relation between two entity
 */
public class MRelation extends MBase{

    /**
     * 
     */
    private static final long serialVersionUID = 2598939248036036692L;

    public final static String MODELTYPE_SRCSIDE = "srcSide";
    public final static String MODELTYPE_DESTSIDE = "destSide";
    public final static String MODELTYPE_MIDDLESIDE = "middleSide";    
    
    private String name;
    private String referenceName;
    private String referenceLabel;
    private String tableName;
    private String fieldSrcEid;
    private String fieldDestEid;
    private String modelType;
    
    private MEntity srcEntity;
    private MEntity destEntity;
    
    public String getName() {
        return name;
    }
    
    public void setName(String name) {
        this.name = name;
    }
    
    public String getReferenceName() {
        return referenceName;
    }
    
    public void setReferenceName(String referenceName) {
        this.referenceName = referenceName;
    }
    
    public String getReferenceLabel() {
        return referenceLabel;
    }
    
    public void setReferenceLabel(String referenceLabel) {
        this.referenceLabel = referenceLabel;
    }
    
    public MEntity getSrcEntity() {
        return srcEntity;
    }
    
    public void setSrcEntity(MEntity srcEntity) {
        this.srcEntity = srcEntity;
    }
    
    public MEntity getDestEntity() {
        return destEntity;
    }
    
    public void setDestEntity(MEntity destEntity) {
        this.destEntity = destEntity;
    }
    
    public String getTableName() {
        return tableName;
    }
    
    public void setTableName(String tableName) {
        this.tableName = tableName;
    }
    
    public String getFieldSrcEid() {
        return fieldSrcEid;
    }
    
    public void setFieldSrcEid(String fieldSrcEid) {
        this.fieldSrcEid = fieldSrcEid;
    }
    
    public String getFieldDestEid() {
        return fieldDestEid;
    }
    
    public void setFieldDestEid(String fieldDestEid) {
        this.fieldDestEid = fieldDestEid;
    }
    
    public String getModelType() {
        return modelType;
    }
    
    public void setModelType(String modelType) {
        this.modelType = modelType;
    }
    

    @Override
    public void copyShallow(MBase mBase) {
        super.copyShallow(mBase);
        
        MRelation mRelation = (MRelation)mBase;
        
        this.name = mRelation.getName();
        this.referenceName = mRelation.getReferenceName();
        this.referenceLabel = mRelation.getReferenceLabel();
        this.tableName = mRelation.getTableName();
        this.fieldSrcEid = mRelation.getFieldSrcEid();
        this.fieldDestEid = mRelation.getFieldDestEid();
        this.modelType = mRelation.getModelType();
    }
}
